package com.xqzgj.web.controller.ai;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xqzgj.common.core.domain.AjaxResult;
import com.xqzgj.system.service.IAiChatService;

/**
 * AI对话控制器
 */
@RestController
@RequestMapping("/ai/chat")
public class AiChatController {
    @Autowired
    private IAiChatService aiChatService;

    /**
     * 发送消息到AI助手
     */
    @PreAuthorize("@ss.hasPermi('ai:chat:send')")
    @PostMapping("/send")
    public AjaxResult sendMessage(@RequestParam String content) {
        return aiChatService.sendMessage(content);
    }

    /**
     * 清除当前对话历史
     */
    @PreAuthorize("@ss.hasPermi('ai:chat:clear')")
    @GetMapping("/clear")
    public AjaxResult clearChat() {
        return aiChatService.clearChat();
    }
}